<?php
/**
 * @author shuang
 * @date 2016-10-27 10:40:40
 */
$this->registerCssFile('/css/task.css', ['depends' => ['frontendx\assets\AppAsset']]);
?>
<div class="opt-bar">
    <div class="left">
        <span>全部类型</span>
        <i class="subscript"></i>
    </div>
    <div class="right">
        <span>智能排序</span>
        <i class="subscript"></i>
    </div>
    <div class="search">
        <i></i>
    </div>
    <div class="drop-down" id="dropDown">
        <div class="left-list">
            <span>全部类型</span>
            <span class="selected">体验推广</span>
            <span>电商推广</span>
            <span>问卷调研</span>
            <span>活动捧场</span>
        </div>
        <div class="right-list">
            <?php foreach ($typeDict as $item): ?>
                <a href="<?php echo \yii\helpers\Url::toRoute(['task/work', 'type' => $item['id'], 'sort' => $sort, 'sortfield' => $sortfield]); ?>"><span class="<?php echo $type == $item['id'] ? "selected" : null ?>"><?php echo $item['name']; ?></span></a>
            <?php endforeach; ?>
        </div>
    </div>
    <div class="drop-down-1" id="dropDown1">
        <a href="<?php echo \yii\helpers\Url::toRoute(['task/work', 'type' => $type, 'sort' => $sort, 'sortfield' => "created_at"]); ?>"><span class="<?php echo $sortfield == "created_at" ? "selected" : null ?>">智能排序</span></a>
        <a href="<?php echo \yii\helpers\Url::toRoute(['task/work', 'type' => $type, 'sort' => $sort, 'sortfield' => "price"]); ?>"><span class="<?php echo $sortfield == "price" ? "selected" : null ?>">按金额排序</span></a>
        <a href="<?php echo \yii\helpers\Url::toRoute(['task/work', 'type' => $type, 'sort' => $sort, 'sortfield' => "number"]); ?>"><span class="<?php echo $sortfield == "number" ? "selected" : null ?>">按剩余量排序</span></a>
    </div>
</div>
<div class="mid-banner">
    <img src="../images/index-mid-banner.png" alt=""/>
</div>
<div class="tasks">
    <div class="opa"></div>
    <div class="task-list fixed">
        <?php foreach ($data as $item): ?>
            <div class="group">
                <div class="left">
                    <i class="<?php echo frontendx\models\WB_Task::$task_type_class[$item['type']]; ?>"></i>
                </div>
                <div class="mid">
                    <span class="title"><?php echo $item['title']; ?></span>
                    <small><?php echo $item['note']; ?></small>
                    <p><i></i> <span><?php echo Yii::$app->formatter->asDecimal($item['brush_price']); ?></span></p>
                </div>
                <div class="right">
                    <a href="<?php echo \yii\helpers\Url::toRoute(["task/taskdetail2","taskid"=>$item["id"]]);?>"><button class="orange">领取</button></a>
                    <span><?php echo $item['taskcount'] ? $item['taskcount'] : 0; ?>人 已做过</span>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
</div>